package com.itheima.dao;

import com.itheima.domian.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BookMapper {
    @Select("select * from book")
    public List<Book> FindAll();

    @Update("update book set name = #{name}, isbn = #{isbn}, press = #{press},author = #{author}, pagination = #{pagination}, price = #{price}, uploadTime = #{uploadTime} where id = #{id}")
    public int UpdateBook(Book book);

    @Select("select * from book where id=#{id}")
    public Book queryBookById(int id);

    @Insert("insert into book(id,name,isbn,press,author,pagination,price,uploadTime) values (#{id},#{name},#{isbn},#{press},#{author},#{pagination},#{price},#{uploadTime})")
    int addBook(Book book);

    @Delete("delete from book where id=#{id}")
    int deleteBook(int id);
}
